package com.atguigu.srb.core.pojo.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * <p>
 * 标的出借记录表
 * </p>
 *
 * @author javaCode
 * @since 2025-07-19
 */
@Getter
@Setter
@Accessors(chain = true)
@TableName("lend_item")
@ApiModel(value = "LendItem对象", description = "标的出借记录表")
public class LendItem implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("编号")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty("投资编号")
    @TableField("lend_item_no")
    private String lendItemNo;

    @ApiModelProperty("标的id")
    @TableField("lend_id")
    private Long lendId;

    @ApiModelProperty("投资用户id")
    @TableField("invest_user_id")
    private Long investUserId;

    @ApiModelProperty("投资人名称")
    @TableField("invest_name")
    private String investName;

    @ApiModelProperty("投资金额")
    @TableField("invest_amount")
    private BigDecimal investAmount;

    @ApiModelProperty("年化利率")
    @TableField("lend_year_rate")
    private BigDecimal lendYearRate;

    @ApiModelProperty("投资时间")
    @TableField("invest_time")
    private LocalDateTime investTime;

    @ApiModelProperty("开始日期")
    @TableField("lend_start_date")
    private LocalDate lendStartDate;

    @ApiModelProperty("结束日期")
    @TableField("lend_end_date")
    private LocalDate lendEndDate;

    @ApiModelProperty("预期收益")
    @TableField("expect_amount")
    private BigDecimal expectAmount;

    @ApiModelProperty("实际收益")
    @TableField("real_amount")
    private BigDecimal realAmount;

    @ApiModelProperty("状态（0：默认 1：已支付 2：已还款）")
    @TableField("status")
    private Integer status;

    @ApiModelProperty("创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime createTime;

    @ApiModelProperty("更新时间")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime updateTime;

    @ApiModelProperty("逻辑删除(1:已删除，0:未删除)")
    @TableLogic
    @TableField("is_deleted")
    private Boolean isDeleted;
}
